<?php
/**
 * @param unknown_type $smarty
 * @param unknown_type $message       信息文本
 * @param unknown_type $type          0: 提示1:警告 2：确认
 * @param unknown_type $links         跳转路径
 * @param unknown_type $autoRedirect  是否自动跳转
 */
function to_message($smarty,$message,$type=0,$links=array(),$autoRedirect=true,$seconds=3){
	if(count($links) == 0){
        $links[0]['text'] = $GLOBALS['_LANG']['go_back'];
        $links[0]['href'] = 'javascript:history.go(-1)';
    }
    $smarty->assign('message',$message);
    $smarty->assign('type',$type);
    $smarty->assign('links',$links);
    $smarty->assign('default_url', $links[0]['href']);
    $smarty->assign('auto_redirect', $autoRedirect);
    $smarty->assign('seconds', $seconds);
    $smarty->display('common/message.htm');
	
}
/**
 * 页面重定向
 */
function to_redirect($url){
	echo "<script language=\"javascript\">";
	echo "location.href=\"$url\"";
	echo "</script>";
}

function to_int($intStr){
	$intStr = isset($intStr)?$intStr:0;
	$int = intval($intStr);
	if(strval($int) == $intStr){
		return $int;
	}else{
		return -1;
	}
}

